footer.init();
var pro_load_page = 2,pro_load_flag = true;

	header.init('快讯');
	title = '快讯';

var kxList = {
	init : function(){
		app.ajax(
			{
				url :'/Member/Shop/k_lists',
				type :'get'
			},
			{
				page:1
			},function(res){
				if(res.code == 200){
					if(res.list.length > 0){
						app.tpl($('.kxs-list'),'tpl-kxs-list',res);
								echo.init();
					}else{
						$('.kxs-list').html("<div class='tC promp-order' style='position:absolute;top:50%;left:15%;height:30%;width:70%;'><span class='cGrey fS15'>亲  这个页面还没有数据哦~</span></div>");
					}
				}else{
					layer.msg('网络繁忙，请稍候再试');
				}
			}
		);
	},
	loadMore :function(url,data){
		var listLoadingEmpty = '<div style="height:3rem;line-height:3rem;text-align:center;font-size:1.2rem;" class="no-more">努力加载中~<div>';
   		$('.kxs-list').append(listLoadingEmpty);
		pro_load_flag = false;
		app.ajax(
			{
				url :url,
				type :'get'
			},
			data,
			function(res){
				$('.kxs-list .no-more').remove();
				if(res.code == 200){
						app.tpladd($('.kxs-list'),'tpl-kxs-list',res);	
								echo.init();
						pro_load_page++;
						pro_load_flag = true;
					//page++;
				}else{						
						var listLoadingEmpty = '<div style="height:3rem;line-height:3rem;text-align:center;font-size:1.2rem;">没有更多数据了~<div>';
						$('.kxs-list').append(listLoadingEmpty);
				}
			});	
	}
}

kxList.init();
window.onload = function(){
	$('body').on('click','.kx-list',function(){//正品综述
		var ids= $(this).attr('data-id');
		app.open('classroom.articleDetail.html','class_article',{id:ids,title:title},window.location.href,document.body.scrollTop);
	});
	
	$(window).scroll(function(){
		echo.init();
		// 当滚动到距底部以上200像素
		var offset = $(".kxs-list").offset(),
		dataType = 0,
		data = {};
		var documentHeight = offset.top + $(".kxs-list").height();
		if (documentHeight - $(this).scrollTop() - $(this).height()<100){
				data = {
					page :pro_load_page,
					limit : 10
				};
			pro_load_flag && articleList.loadMore('/Member/Shop/k_lists',data);
		}
	});
	
};
